#[cfg(test)]
mod tests {
    use super::*;
    use crate::agent_types::AgentCategory;
    use crate::agents::AgentManager;
    use crate::tools::ToolManager;
    use tempfile::TempDir;

    #[tokio::test]
    async fn test_agent_creation() -> anyhow::Result<()> {
        let temp_dir = TempDir::new()?;
        let agents_file = temp_dir.path().join("agents.json");
        let tools_file = temp_dir.path().join("tools.json");

        let agent_manager = AgentManager::new(&agents_file)?;
        let tool_manager = ToolManager::new(&tools_file)?;

        // Test creating a chat agent
        let agent_id = agent_manager.create_agent(
            "Test Agent",
            "openai",
            "gpt-4",
            "You are a test agent.",
            None,
            Some(&["calculator".to_string()]),
            AgentCategory::Chat,
        )?;

        assert_eq!(agent_id, 1);

        // Test getting the agent
        let agent = agent_manager.get_agent(agent_id)?;
        assert!(agent.is_some());

        let agent = agent.unwrap();
        assert_eq!(agent.base_config.name, "Test Agent");
        assert_eq!(agent.category, AgentCategory::Chat);

        Ok(())
    }
}
